/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.applicatioN.entities;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Slim
 */
@Entity
@Table(name = "agent")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Agent.findAll", query = "SELECT a FROM Agent a"),
    @NamedQuery(name = "Agent.findByNumeroDeMatricule", query = "SELECT a FROM Agent a WHERE a.numeroDeMatricule = :numeroDeMatricule"),
    @NamedQuery(name = "Agent.findByDateDeDebut", query = "SELECT a FROM Agent a WHERE a.dateDeDebut = :dateDeDebut"),
    @NamedQuery(name = "Agent.findByDateDeFin", query = "SELECT a FROM Agent a WHERE a.dateDeFin = :dateDeFin"),
    @NamedQuery(name = "Agent.findByDateDeNaissance", query = "SELECT a FROM Agent a WHERE a.dateDeNaissance = :dateDeNaissance"),
    @NamedQuery(name = "Agent.findByDateDeRecrutement", query = "SELECT a FROM Agent a WHERE a.dateDeRecrutement = :dateDeRecrutement"),
    @NamedQuery(name = "Agent.findByDirigeant", query = "SELECT a FROM Agent a WHERE a.dirigeant = :dirigeant"),
    @NamedQuery(name = "Agent.findByAdmin", query = "SELECT a FROM Agent a WHERE a.admin = :admin"),
    @NamedQuery(name = "Agent.findByEtatCivil", query = "SELECT a FROM Agent a WHERE a.etatCivil = :etatCivil"),
    @NamedQuery(name = "Agent.findByMotDePasse", query = "SELECT a FROM Agent a WHERE a.motDePasse = :motDePasse"),
    @NamedQuery(name = "Agent.findByNom", query = "SELECT a FROM Agent a WHERE a.nom = :nom"),
    @NamedQuery(name = "Agent.findByPosteTel", query = "SELECT a FROM Agent a WHERE a.posteTel = :posteTel"),
    @NamedQuery(name = "Agent.findByPrenom", query = "SELECT a FROM Agent a WHERE a.prenom = :prenom"),
    @NamedQuery(name = "Agent.findBySexe", query = "SELECT a FROM Agent a WHERE a.sexe = :sexe")})

public class Agent implements Serializable {
    @Basic(optional = false)
    @Column(name = "DATE_DE_NAISSANCE", nullable = false)
    @Temporal(TemporalType.DATE)
    private Date dateDeNaissance;
    @Basic(optional = false)
    @Column(name = "DATE_DE_RECRUTEMENT", nullable = false)
    @Temporal(TemporalType.DATE)
    private Date dateDeRecrutement;
    @Basic(optional = false)
    @Column(name = "DATE_DE_DEBUT", nullable = false)
    @Temporal(TemporalType.DATE)
    private Date dateDeDebut;
    @Basic(optional = false)
    @Column(name = "DATE_DE_FIN", nullable = false)
    @Temporal(TemporalType.DATE)
    private Date dateDeFin;
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "NUMERO_DE_MATRICULE")
    private Integer numeroDeMatricule;
    @Basic(optional = false)
    @Column(name = "DIRIGEANT")
    private char dirigeant;
    @Basic(optional = false)
    @Column(name = "ADMIN")
    private char admin;
    @Basic(optional = false)
    @Column(name = "ETAT_CIVIL")
    private char etatCivil;
    @Basic(optional = false)
    @Column(name = "MOT_DE_PASSE")
    private String motDePasse;
    @Basic(optional = false)
    @Column(name = "NOM")
    private String nom;
    @Basic(optional = false)
    @Column(name = "POSTE_TEL")
    private int posteTel;
    @Basic(optional = false)
    @Column(name = "PRENOM")
    private String prenom;
    @Basic(optional = false)
    @Column(name = "SEXE")
    private char sexe;
    @JoinColumn(name = "PAYS", referencedColumnName = "PAYS")
    @ManyToOne(optional = false)
    private Bureau pays;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "agent")
    private Collection<TravaillerAvec> travaillerAvecCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "numeroDeMatricule")
    private Collection<Entreprise> entrepriseCollection;

    public Agent() {
    }

    public Agent(Integer numeroDeMatricule) {
        this.numeroDeMatricule = numeroDeMatricule;
    }

    public Agent(Integer numeroDeMatricule, Date dateDeDebut, Date dateDeFin, Date dateDeNaissance, Date dateDeRecrutement, char dirigeant, char admin, char etatCivil, String motDePasse, String nom, int posteTel, String prenom, char sexe) {
        this.numeroDeMatricule = numeroDeMatricule;
        this.dateDeDebut = dateDeDebut;
        this.dateDeFin = dateDeFin;
        this.dateDeNaissance = dateDeNaissance;
        this.dateDeRecrutement = dateDeRecrutement;
        this.dirigeant = dirigeant;
        this.admin = admin;
        this.etatCivil = etatCivil;
        this.motDePasse = motDePasse;
        this.nom = nom;
        this.posteTel = posteTel;
        this.prenom = prenom;
        this.sexe = sexe;
    }

    public Integer getNumeroDeMatricule() {
        return numeroDeMatricule;
    }

    public void setNumeroDeMatricule(Integer numeroDeMatricule) {
        this.numeroDeMatricule = numeroDeMatricule;
    }

    public Date getDateDeDebut() {
        return dateDeDebut;
    }

    public void setDateDeDebut(Date dateDeDebut) {
        this.dateDeDebut = dateDeDebut;
    }

    public Date getDateDeFin() {
        return dateDeFin;
    }

    public void setDateDeFin(Date dateDeFin) {
        this.dateDeFin = dateDeFin;
    }

    public Date getDateDeNaissance() {
        return dateDeNaissance;
    }

    public void setDateDeNaissance(Date dateDeNaissance) {
        this.dateDeNaissance = dateDeNaissance;
    }

    public Date getDateDeRecrutement() {
        return dateDeRecrutement;
    }

    public void setDateDeRecrutement(Date dateDeRecrutement) {
        this.dateDeRecrutement = dateDeRecrutement;
    }

    public char getDirigeant() {
        return dirigeant;
    }

    public void setDirigeant(char dirigeant) {
        this.dirigeant = dirigeant;
    }

    public char getAdmin() {
        return admin;
    }

    public void setAdmin(char admin) {
        this.admin = admin;
    }

    public char getEtatCivil() {
        return etatCivil;
    }

    public void setEtatCivil(char etatCivil) {
        this.etatCivil = etatCivil;
    }

    public String getMotDePasse() {
        return motDePasse;
    }

    public void setMotDePasse(String motDePasse) {
        this.motDePasse = motDePasse;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public int getPosteTel() {
        return posteTel;
    }

    public void setPosteTel(int posteTel) {
        this.posteTel = posteTel;
    }

    public String getPrenom() {
        return prenom;
    }

    public void setPrenom(String prenom) {
        this.prenom = prenom;
    }

    public char getSexe() {
        return sexe;
    }

    public void setSexe(char sexe) {
        this.sexe = sexe;
    }

    public Bureau getPays() {
        return pays;
    }

    public void setPays(Bureau pays) {
        this.pays = pays;
    }

    @XmlTransient
    public Collection<TravaillerAvec> getTravaillerAvecCollection() {
        return travaillerAvecCollection;
    }

    public void setTravaillerAvecCollection(Collection<TravaillerAvec> travaillerAvecCollection) {
        this.travaillerAvecCollection = travaillerAvecCollection;
    }

    @XmlTransient
    public Collection<Entreprise> getEntrepriseCollection() {
        return entrepriseCollection;
    }

    public void setEntrepriseCollection(Collection<Entreprise> entrepriseCollection) {
        this.entrepriseCollection = entrepriseCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (numeroDeMatricule != null ? numeroDeMatricule.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Agent)) {
            return false;
        }
        Agent other = (Agent) object;
        if ((this.numeroDeMatricule == null && other.numeroDeMatricule != null) || (this.numeroDeMatricule != null && !this.numeroDeMatricule.equals(other.numeroDeMatricule))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.applicatioN.entities.Agent[ numeroDeMatricule=" + numeroDeMatricule + " ]";
    }

    
}
